package com.itheima.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealCheckgroupMapper {
    /**
     * 向t_setmeal_checkgroup表中添加数据
     * @param setmealId
     * @param checkgroupId
     */
    @Insert("insert into t_setmeal_checkgroup(setmeal_id,checkgroup_id) values(#{setmealId},#{checkgroupId})")
    void add(Integer setmealId, Integer checkgroupId);

    /**
     * 根据套餐id删除套餐项目组关系表中的数据
     * @param id
     */
    @Delete("delete from t_setmeal_checkgroup where setmeal_id=#{id}")
    void deleteBySetmealId(Integer id);

    @Select("select checkgroup_id from t_setmeal_checkgroup where setmeal_id=#{setmealId}")
    List<Integer> findCheckGroupIdsBySetmealId(Integer setmealId);
}
